<template>
  <div class="EmergencyDetail">
    <div class="flex location-wrap">
      <span class="white">当前位置：</span>
      <el-breadcrumb separator="/">
        <el-breadcrumb-item :to="{ path: '/EWManagement' }">预警管理 </el-breadcrumb-item>
        <el-breadcrumb-item :to="{ path: '/NoticeList' }">预警通知单</el-breadcrumb-item>
        <el-breadcrumb-item>详情</el-breadcrumb-item>
      </el-breadcrumb>
    </div>
    <div class="EmergencyDetail-center">
      <TimeLine :activities="activities" :title="'预警事件流程'" />
      <div class="EmergencyDetail-add">
        <div class="EmergencyDetail-titel">
          <div class="EmergencyDetail-top">预警通知单详情</div>
          <div class="flexBetween">
            <div slot="title" class="flex">
            </div>
            <el-row>
              <el-button size="mini" @click="AddFh">返回</el-button>
            </el-row>
          </div>
        </div>
        <div class="padding10-0">
          <div class="flexAround fontSize18 margin5-0">
            <!-- <div v-for="(item,index) in actionDataList" :key="index">
              {{item.operationName}}
            </div> -->
            <div>编辑</div>
            <div>审批</div>
            <div>发布</div>
            <div>解除</div>
          </div>
          <el-steps :active="actionDataList.length" align-center>
            <!-- <el-step v-for="(item,index) in actionDataList" :key="index">
              <template slot="icon">
                <span class="yuandian1 ydBgcolor"></span>
              </template>
              <template slot="title">
                <div class="fontWeight textNowrap">{{item.operationTime}}</div>
              </template>
            </el-step> -->
            <el-step>
              <template slot="icon">
                <span class="yuandian1" :class="actionDataList.length > 0 ? 'ydBgcolor' : ''"></span>
              </template>
              <template slot="title">
                <div class="fontWeight textNowrap">{{ actionDataList.length > 0 ? actionDataList[0].operationTime : "" }}
                </div>
              </template>
            </el-step>
            <el-step>
              <template slot="icon">
                <span class="yuandian1" :class="actionDataList.length > 1 ? 'ydBgcolor' : ''"></span>
              </template>
              <template slot="title">
                <div class="fontWeight textNowrap">{{ actionDataList.length > 1 ? actionDataList[1].operationTime : "" }}
                </div>
              </template>
            </el-step>
            <el-step>
              <template slot="icon">
                <span class="yuandian1" :class="actionDataList.length > 2 ? 'ydBgcolor' : ''"></span>
              </template>
              <template slot="title">
                <div class="fontWeight textNowrap">{{ actionDataList.length > 2 ? actionDataList[2].operationTime : "" }}
                </div>
              </template>
            </el-step>
            <el-step>
              <template slot="icon">
                <span class="yuandian1" :class="actionDataList.length > 3 ? 'ydBgcolor' : ''"></span>
              </template>
              <template slot="title">
                <div class="fontWeight textNowrap">{{ actionDataList.length > 3 ? actionDataList[3].operationTime : "" }}
                </div>
              </template>
            </el-step>
          </el-steps>
        </div>
        <div class="EmergencyDetail-zt">
          <el-collapse v-model="activeNames">
            <el-collapse-item name="1">
              <div slot="title" class="title_box">
                <div class="flex">
                  <div class="leftLine"></div>
                  <div class="fontSize16">基本信息</div>
                </div>
                <div style="display:flex;align-items: center;">
                  <i :class="judgeActive('1') !== -1 ? 'downArrow1' : 'downArrow2'" />
                </div>
              </div>
              <div class="information_Sources_content">
                <div class="task_distribution marginB15">
                  <div>&nbsp;&nbsp;&nbsp;&nbsp;预警通知单：{{ DetailList.warningNoticeName }}</div>
                </div>
              </div>
              <div class="information_Sources_content">
                <div class="task_distribution marginB15">
                  <div>&nbsp;&nbsp;&nbsp;&nbsp;预警研判单：{{ DetailLists.judgeName }}</div>
                </div>
              </div>
              <div class="information_Sources_content">
                <div class="task_distribution information">
                  <div>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;险情类别：{{ DetailList.dangerName }}</div>
                  <div>&nbsp;&nbsp;预警级别：{{ DetailList.warningLvName }}</div>
                  <div></div>
                  <div>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;影响范围：{{ rangeDetailVos }}</div>
                  <div>&nbsp;&nbsp;影响时间：{{ DetailList.effectStartTime }}至{{ DetailList.effectEndTime }}</div>
                </div>
              </div>
              <div class="information_Sources_content">
                <div class=" marginB15 nametites ">
                  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<div class="nametite">
                    &nbsp;&nbsp;&nbsp;事件概要：</div>
                  <div class="nametit">{{ DetailLists.incidentOutline }}</div>
                </div>
              </div>
              <div class="information_Sources_content">
                <div class=" marginB15 nametites ">
                  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<div class="nametite">
                    &nbsp;&nbsp;&nbsp;调整说明：</div>
                  <div class="nametit">{{ DetailList.adjustExplain }}</div>
                </div>
              </div>
            </el-collapse-item>
            <el-collapse-item name="2">
              <div slot="title" class="title_box">
                <div class="flex">
                  <div class="leftLine"></div>
                  <div class="fontSize16">措施要求</div>
                </div>
                <div style="display:flex;align-items: center;">
                  <i :class="judgeActive('2') !== -1 ? 'downArrow1' : 'downArrow2'" />
                </div>
              </div>
              <LsdTable :compRef="tableList.compRef" ref="gjxm" :autoHeight="tableList.autoHeight"
                :columns="tableList.columns" :tableData="tableList.tableData" :tableAttr="tableList.tableAttr"
                :isSequenceFlag="tableList.isSequenceFlag" />
            </el-collapse-item>
            <el-collapse-item name="3">
              <div slot="title" class="title_box">
                <div class="flex">
                  <div class="leftLine"></div>
                  <div class="fontSize16">预警对象</div>
                </div>
                <div style="display:flex;align-items: center;">
                  <i :class="judgeActive('3') !== -1 ? 'downArrow1' : 'downArrow2'" />
                </div>
              </div>
              <div class="information_Sources_content">
                <div class="task_distribution  nametites">
                  <div class="nametitess">主送单位/部门：</div>
                  <div class="nametit">{{ DetailList.unitName }},公司本部：{{ DetailList.deptName }}</div>
                </div>
              </div>
              <div class="information_Sources_content styleyj">
                <div class="task_distribution marginB15">
                  <div>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;联系人：
                    {{ DetailList.contact }}
                  </div>
                </div>
              </div>
              <div class="information_Sources_content">
                <div class="task_distributions informations">
                  <div>
                    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;抄报：{{
                      DetailList.outTheNewspaper }}
                  </div>
                  <div>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;抄送：{{ DetailList.sendDuplicate }}</div>
                </div>
              </div>
            </el-collapse-item>
            <el-collapse-item name="4">
              <div slot="title" class="title_box">
                <div class="flex">
                  <div class="leftLine"></div>
                  <div class="fontSize16">填报信息</div>
                </div>
                <div style="display:flex;align-items: center;">
                  <i :class="judgeActive('4') !== -1 ? 'downArrow1' : 'downArrow2'" />
                </div>
              </div>
              <div class="information_Sources_content">
                <div class="task_distribution information">
                  <div>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;填报人：
                    {{ DetailList.creator }}
                  </div>
                  <div>单位及部门：{{ DetailList.createDeptName }}</div>
                  <div>填报时间：{{ DetailList.createTime }}</div>
                </div>
              </div>
            </el-collapse-item>
            <el-collapse-item name="5">
              <div slot="title" class="title_box">
                <div class="flex">
                  <div class="leftLine"></div>
                  <div class="fontSize16">审批信息</div>
                </div>
                <div style="display:flex;align-items: center;">
                  <i :class="judgeActive('5') !== -1 ? 'downArrow1' : 'downArrow2'" />
                </div>
              </div>
              <div class="information_Sources_content">
                <div class="task_distribution marginB15">
                  <div>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;审批意见：{{ DetailList.approvalOpinion }}</div>
                </div>
                <div class="task_distribution information">
                  <div>
                    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;审批人：{{
                      DetailList.approvalUser }}
                  </div>
                  <div>单位及部门：{{ DetailList.approvalDept }}</div>
                  <div>审批时间：{{ DetailList.approvalTime }}</div>
                </div>
              </div>
            </el-collapse-item>
          </el-collapse>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import TimeLine from "@/components/component/timeLine.vue";
import { detailList, getIssueJudgeData, getOperationLog } from "@/api/EarlyWarningManagement/yjtzd";
import { getDictByGroup } from "@/api/common.js";
export default {
  name: "EmergencyDetail",
  components: { TimeLine },
  data() {
    return {
      activeNames: ["1", "2", "3", "4", "5"],
      activities: [
      ],
      // 新增的表单
      tableList: {
        isSelectFlag: true,
        compRef: "rwxx",
        autoHeight: true,
        isSequenceFlag: true,
        isShowPage: true,
        resetFlag: true,
        loading: false,
        actions: [
        ],
        tableData: [
          {
            measureRequire: "",
            unitDeptId: ""
          }
        ],
        columns1: [
          {
            prop: "measureRequire",
            label: "有关措施要求",
            align: "center",
            "min-width": "200px",
            render: (h, { row }) => {
              return (
                <div class='peizhi'>
                  <LsdForm
                    compData={{
                      elType: "input",
                      id: "measureRequire",
                      label: "任务内容及要求",
                      attrs: {
                        disabled: true,
                        value: "",
                        placeholder: "请输入",
                        min: 0,
                        type: "text"
                      }
                    }}
                    form={row}
                    {...{
                      on: {}
                    }}
                  ></LsdForm>
                </div>
              );
            }
          },
          {
            prop: "unitDeptName",
            // prop: "unitDeptId",
            label: "责任单位/部门",
            align: "center",
            "min-width": "80px",
            render: (h, { row }) => {
              return (
                <div class='peizhi'>
                  <LsdForm
                    compData={{
                      elType: "input",
                      id: "unitDeptName",
                      name: "unitDeptId",
                      label: "责任部门",
                      align: "center",
                      // dic: "dic_zrbm",
                      attrs: {
                        value: "",
                        clearable: true,
                        filterable: true,
                        disabled: true,
                        multiple: false,
                        "collapse-tags": true
                      },
                      options: this.zrbmOption
                    }}
                    form={row}
                    {...{
                      on: {
                        change(val) {
                          this.zrbmOption.forEach(i => {
                            if (i.value === val) {
                              row.unitDeptName = i.label;
                            }
                          });
                        }
                      }
                    }}
                  ></LsdForm>
                </div>
              );
            }
          }
        ],
        columns: [
          {
            prop: "measureRequire",
            label: "有关措施要求",
            align: "left",
            "min-width": "200px",
            render: (h, { row }) => {
              return (
                <div class='peizhi'>
                  {row.measureRequire}
                </div>
              );
            }
          },
          {
            prop: "unitDeptName",
            label: "责任单位/部门",
            align: "center",
            "min-width": "80px",
            render: (h, { row }) => {
              return (
                <div class='peizhi'>
                  {row.unitDeptName}
                </div>
              );
            }
          }
        ],
        tableAttr: {
          // "max-height": "470px",
          stripe: false,
          border: true,
          fit: true,
          "show-header": true,
          "highlight-current-row": true,
          "cell-style": {
            "font-size": "16px"
          },
          "header-cell-style": {
            "text-align": "center",
            "background-color": "#B1C8F9",
            border: "1px solid #ccc",
            "font-size": "16px"
          }
        }
      },
      DetailList: {},
      DetailLists: {},
      actionDataList: [], // 进度
      rangeDetailVos: []
    };
  },
  mounted() {
    this.detailList();
  },
  methods: {
    judgeActive(data) {
      return this.activeNames.indexOf(data);
    },
    // 获取新增里面的部门字典值
    async Hdepartment() {
      getDictByGroup({ groupCode: "dic_zrbm" }).then(res => {
        const option = res.map((item) => {
          return {
            label: item.dicName,
            value: Number(item.dicCode)
          };
        });
        this.zrbmOption = option;
      });
    },
    detailList() {
      getOperationLog({ id: this.$route.query.id }).then(res => {
        this.actionDataList = res;
      });
      this.Hdepartment();
      detailList({ id: this.$route.query.id }).then(res => {
        this.activities = res.warningFlowListVos;
        this.$set(this.tableList, "tableData", res.warningMeasureDetailVos);
        this.rangeDetailVos = res.rangeDetailVos.map(item => {
          return item.effectRange;
        });
        this.rangeDetailVos = this.rangeDetailVos.join("、");
        this.DetailList = res;
        getIssueJudgeData({ id: res.judgeId }).then(res => {
          this.DetailLists = res;
        });
      });

    },
    // 返回上一级
    AddFh() {
      this.$router.go(-1);
      // this.$router.push({
      // name: "NoticeList"
      // });
    }
  }
};
</script>

<style scoped lang="less">
.styleyj {
  margin-top: 18px;
}

.EmergencyDetail {
  width: 100%;
  height: 100%;

  :deep(.el-input__inner) {
    background-color: #fff;
    border: none;
    color: #303133;
  }

  :deep(.el-collapse-item__arrow) {
    display: none;
  }

  .nametite {
    width: 94px;
  }

  .nametitess {
    width: 120px;
  }

  .nametit {
    flex: 1;
  }

  .nametites {
    display: flex;
    // align-items: center;
    // padding: 0 30px;
    // font-size: 16px;
  }

  .title_box {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
  }

  .downArrow1 {
    display: inline-block;
    width: 10px;
    height: 10px;
    background-image: url("../../../assets/img/downArrow1.png");
    background-repeat: no-repeat;
    background-size: 100% 100%;
  }

  .downArrow2 {
    display: inline-block;
    width: 10px;
    height: 10px;
    background: url("../../../assets/img/downArrow1.png");
    background-repeat: no-repeat;
    background-size: 100% 100%;
    transform: rotate(-180deg);
  }

  //鼠标悬浮样式
  :deep(tr.hover-row) {

    &,
    &.el-table__row--striped {

      &,
      &.current-row {
        >td.el-table__cell {
          background-color: transparent;
        }
      }
    }
  }

  :deep(.el-timeline) {
    width: 85%;
    margin-left: 35px;
    margin-top: 30px;
  }

  :deep(.el-breadcrumb__inner.is-link) {
    font-weight: 100;
    color: #fff;
  }

  :deep(.el-breadcrumb__item:last-child .el-breadcrumb__inner) {
    color: #3270ff;
  }

  :deep(.el-breadcrumb) {
    font-size: 16px;
    line-height: initial;
  }

  :deep(.el-input__inner) {
    font-size: 16px;
  }

  .EmergencyDetail-center {
    width: 100%;
    height: 100%;
    margin-top: 10px;
    display: flex;
    justify-content: space-between;

    .EmergencyDetail-add {
      width: 83%;
      height: 100%;
      background-color: #fff;
      border-radius: 5px;
      overflow: auto;

      .EmergencyDetail-titel {
        margin: 0 20px;
        position: relative;
        padding: 10px 0 5px 0;

        // border-bottom: solid 1px #ccc;
        .EmergencyDetail-top {
          text-align: center;
          font-family: 微软雅黑;
          font-weight: 400;
          font-style: normal;
          font-size: 28px !important;
        }
      }

      .EmergencyDetail-zt {
        overflow-y: auto;
        margin: 0 20px;

        :deep(.el-button--text) {
          color: #606266;
          padding: 2px;
        }

        .EmergencyList-dialog-form-item {
          display: flex;
          justify-content: space-between;
          flex-wrap: wrap;
        }

        .task_distribution {
          display: flex;
          // align-items: center;
          padding: 0 30px;
          font-size: 16px;

          span {
            color: #3561fd;
            text-decoration: underline;
          }
        }

        .task_distributions {
          display: flex;
          align-items: center;
          padding: 0 30px;
          font-size: 16px;

          span {
            color: #3561fd;
            text-decoration: underline;
          }
        }

        .task_distribution.information {
          flex-wrap: wrap;

          div {
            width: 33%;
            margin-bottom: 12px;
            align-items: center;

            img {
              position: relative;
              top: 5px;
              left: 10px;
            }
          }
        }

        .task_distributions.informations {
          flex-wrap: wrap;

          div {
            width: 50%;
            margin-bottom: 12px;
            align-items: center;

            img {
              position: relative;
              top: 5px;
              left: 10px;
            }
          }
        }
      }
    }
  }
}

:deep(.el-step__icon.is-text) {
  border: none;
}

:deep(.el-collapse-item__content) {
  padding-top: 5px;
  padding-bottom: 10px;
  font-size: 16px;
}

.yuandian1 {
  display: inline-block;
  background-color: #ccc;
  width: 100%;
  height: 100%;
  border-radius: 50%;
}

.ydBgcolor {
  background-color: #246dfd;
  box-shadow: 0px 0px 8px 0px rgb(10, 99, 241);
}

.EmergencyList-table-pag {
  float: right;
  margin-top: 10px;

  >div {
    line-height: 32px;
  }
}

:deep(.el-table) {
  font-size: 16px;

  tr {
    > :last-child {
      padding: 0;

      img {
        display: block;
        margin: auto;
      }
    }
  }

  .white-row {
    background: #f0f2f5;
  }
}

:deep(.el-collapse-item__header) {
  border-bottom: 1px solid #ccc;
}

:deep(.el-collapse-item__content) {
  padding: 15px 0;
}

:deep(.el-collapse-item__wrap) {
  border: none;
}

.grid-content {
  background-color: #b1c8f9;
  border: 1px solid #d7d7d7;
  text-align: center;
  padding: 8px 0;
}

.grid-content.bottom_col {
  background-color: #f0f2f5;
  border: 1px solid #d7d7d7;
}

.grid-content.top_col {
  background-color: #fff;
  border-top: none;
  border-bottom: none;
}

.width176 {
  width: 159px;
}

.width150 {
  width: 117px;
}

.width133 {
  width: 133px;
}
</style>
